from pydantic_settings import BaseSettings, SettingsConfigDict
from pydantic import Field

class Settings(BaseSettings):
    # MinIO 配置
    minio_endpoint: str = Field(default="http://192.168.1.58:9000/", alias="MINIO_ENDPOINT")
    minio_access_key: str = Field(alias="MINIO_ACCESS_KEY")
    minio_secret_key: str = Field(alias="MINIO_SECRET_KEY")
    minio_bucket_name: str = Field(alias="MINIO_BUCKET_NAME")
    minio_secure: bool = Field(default=False, alias="MINIO_SECURE")  # 如果使用 HTTPS 则设为 True

    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        case_sensitive=False,
        populate_by_name=True,
        extra="allow"
    )

settings = Settings()
print("Settings loaded:", {
    "endpoint": settings.minio_endpoint,
    "bucket": settings.minio_bucket_name,
    "secure": settings.minio_secure
})